package com.goodfather.textbook.youdao.pad.bean;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.annotations.SerializedName;

/**
 * Created by PVer on 2017/9/29.
 * <p>
 * 商品信息是否解锁
 */

public class Recover implements Parcelable {

    @SerializedName("purchased")
    private boolean purchased;

    /**
     * 有效期，格式"2017-08-10 12:12:10"
     */
    @SerializedName("validity")
    private String validity;

    private String unlockMethod;

    protected Recover(Parcel in) {
        purchased = in.readByte() != 0;
        validity = in.readString();
        unlockMethod = in.readString();
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeByte((byte) (purchased ? 1 : 0));
        dest.writeString(validity);
        dest.writeString(unlockMethod);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<Recover> CREATOR = new Creator<Recover>() {
        @Override
        public Recover createFromParcel(Parcel in) {
            return new Recover(in);
        }

        @Override
        public Recover[] newArray(int size) {
            return new Recover[size];
        }
    };

    public boolean isPurchased() {
        return purchased;
    }

    public void setPurchased(boolean purchased) {
        this.purchased = purchased;
    }

    public String getValidity() {
        return validity;
    }

    public void setValidity(String validity) {
        this.validity = validity;
    }

    public String getUnlockMethod() {
        return unlockMethod;
    }

    public void setUnlockMethod(String unlockMethod) {
        this.unlockMethod = unlockMethod;
    }
}
